package top.jamewen.framework.sbmp.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.transaction.annotation.Transactional;
import top.jamewen.framework.sbmp.common.model.UmsResource;

import java.util.List;

/**
 * <p>
 * 后台资源表 服务类
 * </p>
 *
 * @author jamewen
 * @since 2021-01-13
 */
public interface UmsResourceService extends IService<UmsResource> {

    /**
     * 添加资源
     */
    @Transactional(rollbackFor = Exception.class)
    boolean create(UmsResource umsResource);

    /**
     * 修改资源
     */
    @Transactional(rollbackFor = Exception.class)
    boolean update(Long id, UmsResource umsResource);

    /**
     * 删除资源
     */
    @Transactional(rollbackFor = Exception.class)
    boolean delete(Long id);

    /**
     * 分页查询资源
     */
    @Transactional(rollbackFor = Exception.class)
    Page<UmsResource> list(Long categoryId, String nameKeyword, String urlKeyword, Integer pageSize, Integer pageNum);

    /**
     * 根据权限获取资源
     * @author JameWen
     * @date 2021/1/14
     * @param roleId
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    List<UmsResource> listResource(Long roleId);
}
